<style lang="scss" scoped>
.emergency-rescue {
  .emergency-title {
    font-size: 20px;
    font-weight: 400;
  }

  .pageForm {
    padding: 0 30px;
  }

  .el-divider--horizontal {
    margin: 10px 0;
  }
}
</style>

<template>
  <div class="emergency-rescue">
    <el-row type="flex" justify="end" style="padding-right: 40px">
      <el-button type="primary" @click="saveData">保存</el-button>
    </el-row>
    <el-form label-width="200px" class="pageForm">
      <el-row class="form-row">
        <el-col :span="24">
          <!-- <span class="emergency-title">抢救情况</span> -->
          <span class="emergency-title">其他记录</span>
        </el-col>
        <el-col :span="24">
          <el-divider />
        </el-col>
        <el-col :span="24">
          <el-col :span="8">
            <el-form-item label="是否到达手术室">
              <el-radio-group v-model="arriveOperatingRoom">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
            <el-form-item label="入院诊断">
              <el-input v-model="hospitalDiagnosis" size="mini" style="width: 200px;" />
            </el-form-item>
          </el-col> -->
          <el-col v-if="arriveOperatingRoom == 1" :span="8">
            <el-form-item label="进入手术室时间">
              <el-date-picker
                v-model="emergencySurgeryTime"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
          <el-col v-if="arriveOperatingRoom == 1" :span="8">
            <el-form-item label="离开手术室时间">
              <el-date-picker
                v-model="startEmergencySurgeryTime"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="6">
            <el-form-item label="是否到达ICU">
              <el-radio-group v-model="arriveICU" @change="changeICU">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col v-if="arriveICU == 1" :span="6">
            <el-form-item label="到达ICU时间">
              <el-date-picker v-model="arriveICUTime" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
          <el-col v-if="arriveICU == 1" :span="6">
            <el-form-item label="出ICU时间">
              <el-date-picker v-model="hospitalICUTime" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
          <el-col v-if="arriveICU == 1" :span="6">
            <el-form-item label="ICU住院天数">
              <el-input v-model="icuHLOS" size="mini" style="width: 200px;" />
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="8">
            <el-form-item label="抢救结果">
              <el-radio-group v-model="saveResult">
                <el-radio :label="1">抢救成功</el-radio>
                <el-radio :label="0">抢救失败</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="手术次数">
              <el-input v-model="surgeryCount" size="mini" style="width: 200px;" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="住院费用">
              <el-input v-model="hospitalCosts" size="mini" style="width: 200px;" />
            </el-form-item>
          </el-col>
        </el-col>
        <!-- <el-col :span="24">
          <el-form-item label="数据填报员">
            <el-input v-model="dataFillers" size="mini" style="width: 200px;" />
          </el-form-item>
        </el-col> -->
      </el-row>
      <el-row class="form-row">
        <el-col :span="24">
          <span class="emergency-title">抢救措施</span>
        </el-col>
        <el-col :span="24"><el-divider /></el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">胸腔闭式引流</h5>
          </el-col>
          <el-col :span="8">
            <el-form-item label="提出胸腔闭式引流时间">
              <el-date-picker
                v-model="thoracicDrainageTime"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开始胸腔闭式引流时间">
              <el-date-picker
                v-model="startThoracicDrainageTime"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">呼吸机</h5>
          </el-col>
          <el-col :span="5">
            <el-form-item label="开始使用呼吸机时间">
              <el-date-picker v-model="startVentilator" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="结束使用呼吸机时间">
              <el-date-picker v-model="endVentilator" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="使用时长">
              <el-input v-model="ventilatorDuring" size="mini" style="width: 200px;" placeholder="请填写呼吸机时长(时分)" />
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="呼吸机相关肺炎">
              <el-radio v-model="ventilatorPneumonia" label="1">是</el-radio>
              <el-radio v-model="ventilatorPneumonia" label="0">否</el-radio>
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">静脉通道</h5>
          </el-col>
          <el-col :span="8">
            <el-form-item label="静脉通道">
              <el-radio-group v-model="intravenous">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col v-if="intravenous == 1" :span="12">
            <el-checkbox-group v-model="venousAccess">
              <el-checkbox label="0">安置尿管</el-checkbox>
              <el-checkbox label="1">气管插管</el-checkbox>
              <el-checkbox label="2">颈托</el-checkbox>
              <el-checkbox label="3">甲板</el-checkbox>
            </el-checkbox-group>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">清创缝合</h5>
          </el-col>
          <el-col :span="8">
            <el-form-item label="">
              <el-radio-group v-model="debridementSuture">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">胸外按压</h5>
          </el-col>
          <el-col :span="8">
            <el-form-item label="">
              <el-radio-group v-model="chestCompressions">
                <el-radio :label="1">是</el-radio>
                <el-radio :label="0">否</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">人工气道</h5>
          </el-col>
          <el-col :span="5">
            <el-form-item label="提出建立时间">
              <el-date-picker v-model="rgqdStartTime" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="成功建立时间">
              <el-date-picker v-model="rgqdEndTime" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
        </el-col>

        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">输血</h5>
          </el-col>
          <el-col :span="6">
            <el-form-item label="输血申请时间">
              <el-date-picker v-model="BloodTransfusion" type="datetime" size="mini" value-format="yyyy-MM-dd HH:mm:ss" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="抽取血标本时间">
              <el-date-picker
                v-model="drawBloodTransfusion"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="交叉配血实验时间">
              <el-date-picker
                v-model="crossBloodTransfusion"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
        </el-col>
        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl" />
          </el-col>
          <el-col :span="8">
            <el-form-item label="取血时间">
              <el-date-picker
                v-model="collectBloodTransfusion"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="输血开始时间">
              <el-date-picker
                v-model="startBloodTransfusion"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
        </el-col>

        <el-col :span="24">
          <el-col :span="4">
            <h5 class="fl">紧急手术</h5>
          </el-col>
          <el-col :span="8">
            <el-form-item label="提出紧急手术时间">
              <el-date-picker
                v-model="injuryControlledTime"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开始紧急手术时间">
              <el-date-picker
                v-model="startInjuryControlledTime"
                type="datetime"
                size="mini"
                value-format="yyyy-MM-dd HH:mm:ss"
              />
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-col :span="4">
              <h5 class="fl">急诊抢救说明</h5>
            </el-col>
            <el-col :span="20">
              <el-form-item label="">
                <el-input v-model="instructions" type="textarea" size="mini" />
              </el-form-item>
            </el-col>
          </el-col>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
import { firstTouchPoints, saveCure } from '@/api/green-channel/emergencyRescue'
import { saveEventWeb } from '@/api/green-channel/saveEvent'
export default {
  props: ['checkrowdata'],
  data() {
    return {
      event50001Info: null, // 50001信息
      event50002Info: null, // 50002信息
      event50003Info: null, // 50003信息
      event50004Info: null, // 50003信息
      event50005Info: null, // 50003信息
      event50006Info: null, // 50006信息
      event50007Info: null, // 50007信息
      event50008Info: null, // 50008信息
      event50009Info: null, // 50009信息
      event50010Info: null, // 50010信息
      event50011Info: null, // 50011信息
      event50012Info: null, // 50012信息
      event50013Info: null, // 50013信息
      event50014Info: null, // 50014信息
      event50015Info: null, // 50015信息
      event50016Info: null, // 50016信息
      event50021Info: null, // 50021信息
      event50022Info: null, // 50022信息
      event50023Info: null, // 50023信息
      event50024Info: null, // 50024信息
      event50025Info: null, // 50025信息
      event50026Info: null, // 50026信息
      userId: '',
      missionId: '',
      hospitalDiagnosis: '', // 入院诊断
      emergencySurgeryTime: '', // 提出紧急手术时间
      startEmergencySurgeryTime: '', // 开始手术时间
      saveResult: 0, // 抢救结果
      surgeryCount: '', // 手术次数
      hospitalCosts: '', // 住院费用
      arriveICU: 0, // 是否到达ICU
      arriveOperatingRoom: 0, // 是否到达手术室
      arriveICUTime: '', // 到达ICU时间
      hospitalICUTime: '', // 出ICU时间
      icuHLOS: '', //  ICU住院天数
      dataFillers: '', // 数据填报员
      thoracicDrainageTime: '', // 提出胸腔闭式引流时间
      startThoracicDrainageTime: '', // 开始胸腔闭式引流时间
      startVentilator: '', // 开始使用呼吸机时间
      endVentilator: '', // 结束呼吸机使用时间
      ventilatorDuring: '', // 呼吸机时长
      ventilatorPneumonia: '', // 呼吸机相关肺炎
      intravenous: 0, // 静脉通道
      venousAccess: [], // 静脉通道选项
      chestCompressions: 0, // 胸外按压
      BloodTransfusion: '', // 输血申请时间
      drawBloodTransfusion: '', // 抽取血标本时间
      startBloodTransfusion: '', // 输血开始时间
      collectBloodTransfusion: '', // 取血开始时间
      crossBloodTransfusion: '', // 交叉配血时间
      injuryControlledTime: '', // 提出损伤控制性手术时间
      startInjuryControlledTime: '', // 开始损伤性控制手术时间
      instructions: '', // 急诊抢救说明
      debridementSuture: 0, // 清创缝合
      rgqdStartTime: '', // 人工气道提出时间
      rgqdEndTime: '' // 人工气道建立时间
    }
  },
  watch: {
    hospitalICUTime(newVal, oldVal) {
      this.changeICU1()
    },
    arriveICUTime(newVal, oldVal) {
      this.changeICU1()
    },
    endVentilator(newVal, oldVal) {
      this.changeHXJ()
    },
    startVentilator(newVal, oldVal) {
      this.changeHXJ()
    }
  },
  mounted() {
    this.init()
  },
  methods: {
    init() {
      this.event50001Info = {}
      this.event50002Info = {}
      this.event50003Info = {}
      this.event50004Info = {}
      this.event50005Info = {}
      this.event50006Info = {}
      this.event50007Info = {}
      this.event50008Info = {}
      this.event50009Info = {}
      this.event50010Info = {}
      this.event50011Info = {}
      this.event50012Info = {}
      this.event50013Info = {}
      this.event50014Info = {}
      this.event50015Info = {}
      this.event50016Info = {}
      this.event50021Info = {}
      this.event50022Info = {}
      this.event50023Info = {}
      this.event50024Info = {}
      this.event50025Info = {}
      this.event50026Info = {}
      this.thoracicDrainageTime = ''
      this.startThoracicDrainageTime = ''
      this.startVentilator = ''
      this.endVentilator = ''
      this.ventilatorDuring = ''
      this.ventilatorPneumonia = ''
      this.intravenous = 0
      this.chestCompressions = 0
      this.BloodTransfusion = ''
      this.startBloodTransfusion = ''
      this.collectBloodTransfusion = ''
      this.crossBloodTransfusion = ''
      this.injuryControlledTime = ''
      this.startInjuryControlledTime = ''
      this.instructions = ''
      this.emergencySurgeryTime = ''
      this.hospitalDiagnosis = ''
      this.startEmergencySurgeryTime = ''
      this.dataFillers = ''
      this.saveResult = 0
      this.arriveICU = 0
      this.arriveOperatingRoom = 0
      this.surgeryCount = ''
      this.hospitalCosts = ''
      this.debridementSuture = 0
      this.drawBloodTransfusion = ''
      this.crossBloodTransfusion = ''
      this.userId = this.$store.getters.userId
      this.missionId = this.checkrowdata.dispatchId
      this.icuHLOS = '0'
      this.changeICU1()
      firstTouchPoints({
        apiToken: this.$store.getters.apiToken,
        dispatchId: this.checkrowdata.dispatchId
      }).then(res => {
        if (res.code == 0) {
          if (res.data && res.data.length > 0) {
            res.data.forEach(el => {
              if (el.event_id == '50001') {
                this.event50001Info = el
                this.startThoracicDrainageTime = el.hit_time
              }
              if (el.event_id == '50002') {
                this.event50002Info = el
                this.thoracicDrainageTime = el.hit_time
              }
              if (el.event_id == '50003') {
                this.event50003Info = el
                this.startVentilator = el.hit_time
                this.ventilatorDuring = el.detail
                this.ventilatorPneumonia = el.property2
              }
              if (el.event_id == '50004') {
                this.event50004Info = el
                this.rgqdStartTime = el.hit_time
              }
              if (el.event_id == '50005') {
                this.event50005Info = el
                this.rgqdEndTime = el.hit_time
              }
              if (el.event_id == '50006') {
                this.event50006Info = el
                this.BloodTransfusion = el.hit_time
              }
              if (el.event_id == '50007') {
                this.event50007Info = el
                this.startBloodTransfusion = el.hit_time
              }
              if (el.event_id == '50008') {
                this.event50008Info = el
                this.injuryControlledTime = el.hit_time
                this.instructions = el.detail
              }
              if (el.event_id == '50009') {
                this.event50009Info = el
                this.startInjuryControlledTime = el.hit_time
              }
              if (el.event_id == '50010') {
                this.event50010Info = el
                this.intravenous = el.state
                if (el.property2) {
                  let venousAccess_data = el.property2.split('|')
                  if (venousAccess_data && venousAccess_data.length > 0) {
                    venousAccess_data = venousAccess_data.filter(ele => ele && ele !== '')
                    this.venousAccess = venousAccess_data
                  }
                }
              }
              if (el.event_id == '50011') {
                this.event50011Info = el
                this.chestCompressions = el.state
              }

              if (el.event_id == '50012') {
                this.event50012Info = el
                this.drawBloodTransfusion = el.hit_time
              }
              if (el.event_id == '50013') {
                this.event50013Info = el
                this.crossBloodTransfusion = el.hit_time
              }
              if (el.event_id == '50014') {
                this.event50014Info = el
                this.collectBloodTransfusion = el.hit_time
              }
              if (el.event_id == '50015') {
                this.event50015Info = el
                this.debridementSuture = el.state
              }
              if (el.event_id == '50016') {
                this.event50016Info = el
                this.endVentilator = el.hit_time
              }
              if (el.event_id == '50021') {
                this.event50021Info = el
                this.emergencySurgeryTime = el.hit_time
                this.arriveOperatingRoom = el.state
              }
              if (el.event_id == '50022') {
                this.event50022Info = el
                this.hospitalDiagnosis = el.detail
                this.startEmergencySurgeryTime = el.hit_time
                this.dataFillers = el.property2
              }
              if (el.event_id == '50023') {
                this.event50023Info = el
                this.arriveICU = el.state
                this.arriveICUTime = el.hit_time
              }
              if (el.event_id == '50024') {
                this.event50024Info = el
                this.icuHLOS = el.property2
              }
              if (el.event_id == '50025') {
                this.event50025Info = el
                this.saveResult = el.state
                this.surgeryCount = el.detail
                this.hospitalCosts = el.property2
              }
              if (el.event_id == '50026') {
                this.event50026Info = el
                this.hospitalICUTime = el.hit_time
              }
            })
          }
        }
      })
    },
    // 改变icu
    changeICU(val) {
      if (val == 0) {
        this.arriveICUTime = ''
        this.hospitalICUTime = ''
        this.icuHLOS = '0'
      } else {
        this.changeICU1()
      }
    },
    changeICU1() {
      this.icuHLOS = ((new Date(this.hospitalICUTime).getTime() - new Date(this.arriveICUTime).getTime()) / 1000 / 60 / 60 / 24)
      if (this.icuHLOS > 0) {
        Math.floor(this.icuHLOS * 100) / 100.0
        this.icuHLOS = this.icuHLOS.toFixed(2).slice(0, -1)
      } else {
        this.icuHLOS = '0'
      }
    },
    changeHXJ() {
      this.ventilatorDuring = (new Date(this.endVentilator).getTime() - new Date(this.startVentilator).getTime()) / 1000 / 60 / 60
      if (!this.ventilatorDuring) {
        this.ventilatorDuring = 0
      }
    },
    async saveData() {
      // let arr = []
      const rescueData = [{
        detail: '',
        event_id: 50001,
        hit_time: this.startThoracicDrainageTime,
        id: this.event50001Info.id,
        missionId: this.missionId,
        property1: null,
        property2: '',
        property3: null,
        mission: '',
        source: this.event50001Info.source,
        state: this.event50001Info.state,
        target: null,
        type: this.event50001Info.type,
        userId: this.userId
      }, {
        detail: '',
        event_id: 50002,
        hit_time: this.thoracicDrainageTime,
        id: this.event50002Info.id,
        missionId: this.missionId,
        property1: null,
        property2: '',
        property3: null,
        source: this.event50002Info.source,
        state: this.event50002Info.state,
        target: null,
        type: this.event50002Info.type,
        user: this.userId
      }, {
        detail: this.ventilatorDuring,
        event_id: 50003,
        hit_time: this.startVentilator,
        id: this.event50003Info.id,
        missionId: this.missionId,
        property1: null,
        property2: this.ventilatorPneumonia,
        property3: null,
        source: this.event50003Info.source,
        state: this.startVentilator ? 1 : 0,
        target: null,
        type: this.event50003Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50006,
        hit_time: this.BloodTransfusion,
        id: this.event50006Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50006Info.source,
        state: this.event50006Info.state,
        target: null,
        type: this.event50006Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50007,
        hit_time: this.startBloodTransfusion,
        id: this.event50007Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50007Info.source,
        state: this.event50007Info.state,
        target: null,
        type: this.event50007Info.type,
        user: this.userId
      }, {
        detail: this.instructions,
        event_id: 50008,
        hit_time: this.injuryControlledTime,
        id: this.event50008Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50008Info.source,
        state: this.event50008Info.state,
        target: null,
        type: this.event50008Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50009,
        hit_time: this.startInjuryControlledTime,
        id: this.event50009Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50009Info.source,
        state: this.event50009Info.state,
        target: null,
        type: this.event50009Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50010,
        hit_time: '',
        id: this.event50010Info.id,
        missionId: this.missionId,
        property1: null,
        property2: '|' + this.venousAccess.join('|') + '|',
        property3: null,
        source: this.event50010Info.source,
        state: this.intravenous,
        target: null,
        type: this.event50010Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50011,
        hit_time: '',
        id: this.event50011Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50011Info.source,
        state: this.chestCompressions,
        target: null,
        type: this.event50011Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50012,
        hit_time: this.drawBloodTransfusion,
        id: this.event50012Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50012Info.source,
        state: this.event50012Info.state,
        target: null,
        type: this.event50012Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50013,
        hit_time: this.crossBloodTransfusion,
        id: this.event50013Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50013Info.source,
        state: this.event50013Info.state,
        target: null,
        type: this.event50013Info.type,
        user: this.userId
      },
      {
        detail: '',
        event_id: 50014,
        hit_time: this.collectBloodTransfusion,
        id: this.event50014Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50014Info.source,
        state: this.event50014Info.state,
        target: null,
        type: this.event50014Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50015,
        hit_time: '',
        id: this.event50015Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50015Info.source,
        state: this.debridementSuture,
        target: null,
        type: this.event50015Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50016,
        hit_time: this.endVentilator,
        id: this.event50016Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50016Info.source,
        state: this.endVentilator ? 1 : 0,
        target: null,
        type: this.event50016Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50021,
        hit_time: this.emergencySurgeryTime,
        id: this.event50021Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50021Info.source,
        state: this.emergencySurgeryTime === '' || this.emergencySurgeryTime === null ? 0 : this.arriveOperatingRoom,
        target: null,
        type: this.event50021Info.type,
        user: this.userId
      }, {
        detail: this.hospitalDiagnosis,
        event_id: 50022,
        hit_time: this.startEmergencySurgeryTime,
        id: this.event50022Info.id,
        missionId: this.missionId,
        property1: null,
        property2: this.dataFillers,
        property3: null,
        source: this.event50022Info.source,
        state: this.event50022Info.state,
        target: null,
        type: this.event50022Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50023,
        hit_time: this.arriveICUTime,
        id: this.event50023Info.id,
        missionId: this.missionId,
        property1: null,
        property2: null,
        property3: null,
        source: this.event50023Info.source,
        state: this.arriveICUTime === '' || this.arriveICUTime === null ? 0 : this.arriveICU,
        target: null,
        type: this.event50023Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50024,
        hit_time: '',
        id: this.event50024Info.id,
        missionId: this.missionId,
        property1: null,
        property2: this.icuHLOS,
        property3: null,
        source: this.event50024Info.source,
        state: this.event50024Info.state,
        target: null,
        type: this.event50024Info.type,
        user: this.userId
      }, {
        detail: this.surgeryCount,
        event_id: 50025,
        hit_time: '',
        id: this.event50025Info.id,
        missionId: this.missionId,
        property1: null,
        property2: this.hospitalCosts,
        property3: null,
        source: this.event50025Info.source,
        state: this.saveResult,
        target: null,
        type: this.event50025Info.type,
        user: this.userId
      }, {
        detail: '',
        event_id: 50026,
        hit_time: this.hospitalICUTime,
        id: this.event50026Info.id,
        missionId: this.missionId,
        property1: null,
        property2: this.hospitalCosts,
        property3: null,
        source: this.event50026Info.source,
        state: this.event50026Info.state,
        target: null,
        type: this.event50026Info.type,
        user: this.userId
      }]

      await this.awaitchange(rescueData)
      this.$message({
        type: 'success',
        message: '保存成功'
      })
      this.init()

      // rescueData.forEach(el => {
      //   arr.push(JSON.stringify(el))
      // })
      // console.log(arr.length)
      // saveCure({
      //   cure: arr.join('#')
      // }).then(res => {
      //   if (res.code == 0) {
      //     this.$message({
      //       type: 'success',
      //       message: '保存成功'
      //     })
      //   }
      // })
      // await rescueData.forEach(await el => {
      //   el.apiToken = this.$store.getters.apiToken
      //   saveEventWeb(el).then(async res => {
      //     if (res.code == 0) {
      //       console.log(1)
      //     }
      //   })
      // });
      // console.log(2)
      // this.$message({
      //   type: 'success',
      //   message: '保存成功'
      // })

      // saveEventWeb({
      //   apiToken: this.$store.getters.apiToken,
      //   detail: '',
      //   event_id: 50023,
      //   hit_time: this.arriveICUTime,
      //   id: this.event50023Info.id,
      //   missionId: this.missionId,
      //   property1: null,
      //   property2: null,
      //   property3: null,
      //   source: this.event50023Info.source,
      //   state: this.arriveICUTime === '' || this.arriveICUTime === null ? 0 : this.arriveICU,
      //   target: null,
      //   type: this.event50023Info.type,
      //   user: this.userId
      // }).then(res => {
      //   if (res.code == 0) {
      //     this.$message({
      //       type: 'success',
      //       message: '保存成功'
      //     })
      //     this.init()
      //   }
      // })
    },

    // 原接口有问题无法提交修改，改为同步请求调用单接口
    async awaitchange(data) {
      for (let i = 0; i < data.length; i++) {
        data[i].apiToken = this.$store.getters.apiToken
        await saveEventWeb(data[i]).then(async res => {
          // if (res.code == 0) {
          //   await console.log(1)
          // }
        })
      }
    }
  }
}
</script>
